﻿<%@ Control language="C#" Inherits="Common.Controls.UploadFile" CodeFile="tm_UploadImage.ascx.cs" AutoEventWireup="true"%>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<asp:Panel ID="pnlUploadFile" runat="server">
    <table border="0" width="550">
        <%--<tr>
            <td colspan="3" style="background-color: #0099ff">
                <asp:Label ID="lblTitle" runat="server" Font-Bold="True" ForeColor="White" Text="ĐÍNH KÈM TỆP"></asp:Label></td>
        </tr>--%>
        <tr>
            <td colspan="1" style="width: 113px">
            </td>
            <td colspan="2"></td>
        </tr>
        <tr>
            <td align="right" style="width: 113px; height: 26px">
            </td>
            <td style="width: 168px; height: 26px;">
                <asp:Label ID="lblChooseFile" runat="server" Text="Chọn tệp :"></asp:Label>
            </td>
            <td style="height: 26px; width: 481px;">
                <asp:FileUpload ID="fulUpload" runat="server" EnableViewState="False" Width="370px" />
                </td>
        </tr>
        <tr>
            <td align="right" style="width: 113px">
            </td>
            <td style="width: 168px">
                <asp:Label ID="lblDesc" runat="server" Text="Mô tả :"></asp:Label>
                <asp:Label ID="Label4" runat="server" ForeColor="Red" Text="*"></asp:Label></td>
            <td style="width: 481px">
                <asp:TextBox ID="tbxDesc" runat="server" Width="370px"></asp:TextBox></td>
        </tr>
        <tr>
            <td align="right" style="width: 113px; height: 26px">
            </td>
            <td align="right" style="width: 168px; height: 26px;">
                </td>
            <td style="height: 26px; width: 481px;">
                <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" />
                <asp:Label ID="lblFileNameStr" runat="server" Visible="False"></asp:Label></td>
        </tr>
        <tr>
            <td style="width: 113px; height: 26px">
            </td>
            <td style="width: 168px; height: 26px;"></td>
            <td style="width: 481px; height: 26px;">
                <asp:Label ID="lblNotice" runat="server" Font-Bold="True" ForeColor="Red" Visible="False"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
                <asp:GridView ID="gvFileName" runat="server" AutoGenerateColumns="False" 
                            DataKeyNames="id" DataSourceID="dsShowFiles"
                            OnRowCommand="gvFileName_RowCommand" 
                            OnRowDataBound="gvFileName_RowDataBound" PageSize="3" Width="100%" CssClass="table"
                            >
                    <Columns>
                        <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True" SortExpression="id" Visible="False" />
                        <asp:BoundField DataField="userId" HeaderText="userId" SortExpression="userId" Visible="False" />
                        <asp:TemplateField HeaderText="STT">
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# getFileIndex() %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="M&#244; tả">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("fileDesc") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# GetURL(DataBinder.Eval(Container.DataItem, "fileName").ToString()) %>' ><asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "fileDesc") %>'></asp:Label></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Định danh">
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# GetURL(DataBinder.Eval(Container.DataItem, "fileName").ToString()) %>' ><asp:Label ID="Label1" runat="server" Text='<%# (DataBinder.Eval(Container.DataItem, "fileName").ToString()).Substring(0, (DataBinder.Eval(Container.DataItem, "fileName").ToString()).LastIndexOf(".")) %>'></asp:Label></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton2" CommandName="DeleteFile" CommandArgument='<%# Bind("id") %>' runat="server" >
                                    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/FileManager/ToolBarDeleteEnabled.gif" /></asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="30px" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
               </td>
        </tr>
    </table>
<asp:SqlDataSource ID="dsShowFiles" runat="server"></asp:SqlDataSource >
    </asp:Panel>
<asp:Panel ID="pnlFileList" runat="server">
    <table width="550" border="0"> 
        <tr>
            <td>
                <asp:GridView ID="gvManageFile" runat="server" AutoGenerateColumns="False"
                    DataSourceID="dsManageFile" Width="100%" AllowPaging="True" CssClass="table" PageSize="1" OnPageIndexChanging="gvManageFile_PageIndexChanging">
                    <Columns>
                        <asp:TemplateField HeaderText="LOGO">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Image ID="Image2" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "fileName") %>' /><br />
                                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# GetURL(DataBinder.Eval(Container.DataItem, "fileName").ToString()) %>' Text='<%# DataBinder.Eval(Container.DataItem, "fileName") %>' ></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
     </table>
    <asp:SqlDataSource ID="dsManageFile" runat="server">
        
    </asp:SqlDataSource>
    </asp:Panel>
    
    <asp:Label ID="lblIdValue" runat="server" Text="0" Visible="False"></asp:Label>
    <asp:Label ID="lblUploadMask" runat="server" Text="0" Visible="False"></asp:Label>
    <asp:Label ID="lblUploadDir" runat="server" Text="0" Visible="False"></asp:Label>
    <asp:Label ID="lblIdName" runat="server" Text="0" Visible="False"></asp:Label>
    <asp:Label ID="lblFileTable" runat="server" Text="0" Visible="False"></asp:Label>
    <asp:Label ID="lblInfoFileTable" runat="server" Text="0" Visible="False"></asp:Label>
<asp:Label ID="lblDebugMessage" runat="server" Visible="False"></asp:Label>
    
